package framework.sequential;

import framework.common.DeviceRequest;
import framework.common.DeviceResponse;

public class DeviceServer extends framework.common.DeviceServer {

	public DeviceServer(String deviceName) {
		setDeviceName(deviceName);
	}

	// used in sequential and concurrent model
	protected void loop() {
		if (hasRequest()) {
			DeviceRequest request = getRequest();
			System.out.println("got request " + request.toString());
			DeviceResponse response = new DeviceResponse(request);
			service(request, response);
			putResponse(response);
		} else {
			// System.out.println(deviceName +
			// " does nothing because of no request");
		}
	}

	@Override
	public void run() {
		while (true) {
			loop();
		}
	}

	@Override
	public void start() {

	}

	@Override
	public void stop() {

	}

}
